|
|
|
|
|
|
|
SELECT Publishers.Name,PublisherComments.Comments
FROM Publishers LEFT JOIN PublisherComments
ON Publishers.PubID = PublisherComments.PubID |
|
|
|
|
|
|
|
|
Figure 8.29.
Using an INNER JOIN on a nonunique column. |
|
|
|
|
|
|
|
|
Figure 8.30.
Using the LEFT JOIN clause. |
|
|
|
|
|
|
|
|
Notice that the result set has blank comments in several places. The LEFT JOIN is handy when you want a list of all the records in the master table and any records in the dependent table that are on file. |
|
|
|
|
|
|
|
|
The RIGHT JOIN works the same as the LEFT JOIN except that the result set is based on the second (right-hand) table in the JOIN statement. You can use the RIGHT JOIN in the same manner you would use the LEFT JOIN. |
|
|
|
|
|